﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using SmallERP.DAL;
using SmallERP.MODEL.FoundationModel;
using Smallerp.Contracts;
using System.Data;

namespace SmallERP.Bll.PrintManage
{
    public class PaperFaceBLL
    {
        IOperateDB _OperateDb;
        public PaperFaceBLL(IOperateDB Inop)
        {
            _OperateDb = Inop;
        }
        /// <summary>
        /// 获得纸面列表
        /// </summary>
        /// <returns></returns>
        public List<PaperFace_Info> GetPaperFaceList()
        {
            List<PaperFace_Info> list = new List<PaperFace_Info>();
            DataTable dt = _OperateDb.QueryDataTable("select * from PaperFace");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow row = dt.Rows[i];
                PaperFace_Info paperFace = new PaperFace_Info();
                paperFace.PaperFaceId = Convert.ToInt32(row["PaperFaceId"]);
                paperFace.PaperFaceName = (row["PaperFaceName"]).ToString();
                list.Add(paperFace);

            }
            return list;
        }

        /// <summary>
        /// 获得纸面
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public PaperFace_Info GetPaperFace(string name)
        {
            DataTable dt = DAL.AccessHelper.dataTable("select * from PaperFace where PaperFaceName='" + name + "'");

            DataRow row = dt.Rows[0];
            PaperFace_Info paperFaceInfo = new PaperFace_Info();
            paperFaceInfo.PaperFaceId = Convert.ToInt32(row["PaperFaceId"]);
            paperFaceInfo.PaperFaceName = (row["PaperFaceName"]).ToString();


            return paperFaceInfo;
           
        }
    }
}
